#pragma once

#include <ros/ros.h>
#include <huniplacer/huniplacer.h>
#include <deltarobotnode/motionSrv.h>

#include "CrateModel.h"
#include "RangeModel.h"
#include "RobotModel.h" 

#include "InfoPanel.h"
#include "ProgressBar.h"
#include "Indicator.h"
#include "LogPanel.h"

#include "Picking.h"

using namespace huniplacer;

struct rosData {
	ros::NodeHandle* node;
	ros::ServiceClient moveToSrv;
	ros::Subscriber motionReceiver;
	ros::Subscriber crateReceiver;
	ros::Subscriber positionReceiver;
	ros::Subscriber topviewReceiver;
	ros::Subscriber demoProgressReceiver;	
};

struct modelData{
	modelData():pivot(0,0,0){}
	inverse_kinematics_impl* ikmodel;
	imotor3* motor;
	effector_boundaries* eb;
	RobotModel* robot;
	RangeModel range;
	point3 pivot;
	float deltatime;
	
	bool draw_crates;
	bool draw_motor_0;
	bool draw_motor_1;
	bool draw_motor_2;
	bool draw_glass_plate;
	bool draw_beads;
	bool draw_info_panel;
	
	std::vector<Picking*> picking_ids;
	bool picking;
	
	char* crate_xml;
};

struct panelData{
	InfoPanel* i_panel;
	ProgressBar* progressBar;
	Indicator* motor_angles[3];
	LogPanel* log;
};

struct huniplacerData{
	rosData rosdata;
	modelData modeldata;
	panelData paneldata;
};

huniplacerData* getHuniplacerData();
bool get_draw_crates();
bool get_draw_motor(int);
bool get_draw_glass_plate();
